package main;

import objects.Bin;
import objects.Transaction;
import managers.BinManager;

import com.lambdaworks.codec.Base64;
import com.lambdaworks.crypto.SCrypt;
import com.lambdaworks.crypto.SCryptUtil;

import constants.Currency;
import constants.TransactionDirection;

import database.DBManager;

public class Labels {

	public static void main(String[] args) {
		String sUrlString = "jdbc:sqlite:working_dir/hello.db";
		try {
			DBManager.initDBManager();
			/*	System.out.println(SCryptUtil.scrypt("HelloWorld", 8, 1, 1));
			System.out.println(SCryptUtil.scrypt("HelloWorld", 4, 1, 1));
			String scryptOutput = SCryptUtil.scrypt("HelloWorld", 4096, 8, 16);

			String[] split = scryptOutput.split("\\$");
			for (String s : split) {
				System.out.println(s);
				System.out.println(split[3]);
			}
			
			String Npr = split[2];
			String salt = split[3];
			String key = split[4];
			char[] saltChars = salt.toCharArray();
			SCrypt.scrypt("HelloWorld".getBytes(), salt.getBytes(), 2048, 16, 16, 256);
			System.out.println(Base64.encode(SCrypt.scrypt("HelloWorld".getBytes(), Base64.decode(saltChars), 4096, 8, 16, 32)));*/
			
			BinManager.addBin(new Bin("Undefined"));
			BinManager.addBin(new Bin("Motorcyle"));
			BinManager.addBin(new Bin("Food"));
			BinManager.addBin(new Bin("Undefined"));
			
			Transaction t = new Transaction(80460, Currency.EUR, null, "Some test transaction", BinManager.getBinByName("Undefined"), TransactionDirection.ADD, 789654);
			Transaction t2 = new Transaction(7897, Currency.EUR, null, "Some test transaction", BinManager.getBinByName("Food"), TransactionDirection.ADD, 789654);
			Transaction t3 = new Transaction(654, Currency.EUR, null, "Some test transaction", BinManager.getBinByName("Motorcyle"), TransactionDirection.ADD, 789654);
			DBManager.insetTransaction(t);
			DBManager.insetTransaction(t2);
			DBManager.insetTransaction(t3);
			
			
			System.out.println(BinManager.getBins().size());
			
		/*	UserMethods user = new UserMethods();
		//	user.registerUser("Jelle", "Heya!!");
		//	byte[] key = user.checkUser("Jelle","Heya!!");
			String output;
			if(key != null) {
				output = "User authenticated! Cryptokey = "+new String(key)+" and that is "+key.length+" bytes long";
			}
			else {
					output = "key was null";
			}
			
			System.out.println(output);
			*/
			DBManager.closeConnection();
			
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}
}